<?php

namespace app\admin\controller;

use app\BaseApiController;

class Index extends BaseApiController
{
    /**
     * 控制器中间件
     */
    protected $middleware = ['token'];
    
    /**
     * 后台首页
     */
    public function index()
    {
        $user = $this->request->user ?? null;
        
        return $this->success([
            'module' => 'admin',
            'user' => $user,
            'time' => date('Y-m-d H:i:s')
        ], '后台管理首页');
    }
    
    /**
     * 获取用户信息
     */
    public function userInfo()
    {
        $user = $this->request->user ?? null;
        
        return $this->success($user, '获取用户信息成功');
    }
    
    /**
     * 获取系统信息
     */
    public function systemInfo()
    {
        return $this->success([
            'php_version' => PHP_VERSION,
            'thinkphp_version' => \think\facade\App::version(),
            'server_time' => date('Y-m-d H:i:s'),
            'memory_usage' => memory_get_usage(true)
        ], '获取系统信息成功');
    }
}
